package com.gonsin.gview.common.bean;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.DefaultValue;
import com.gitee.sunchenbin.mybatis.actable.annotation.Foreign;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableComment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "gs_user_user_menu")
@TableName("gs_user_user_menu")
@ApiModel("用户菜单表")
@TableComment("用户菜单表")
@Data
public class UserMenuBean {

    @Id
    @TableId("menu_key")
    @Column(name = "menu_key", columnDefinition = "varchar(64) comment '菜单主键'")
    @ApiModelProperty("菜单的主键")
    private String menuKey;

    @TableField("edifice_key")
    @Foreign(name = "fk___edifice_key", foreignTable = "gs_user_edifice", foreignColumn = "edifice_key")
    @Column(name = "edifice_key", columnDefinition = "varchar(64) comment '会议中心主键'", nullable = false)
    @ApiModelProperty("会议中心主键")
    private String edificeKey;

    @TableField("name")
    @Column(name = "name", columnDefinition = "varchar(32) comment '菜单主键'")
    @ApiModelProperty("菜单的主键")
    // name在 edificeKey的范围内必须唯一
//    @Unique(columns = {"name", "edifice_key"})
    private String name;

    @TableField("sort")
    @Column(name = "sort", columnDefinition = "int(8) comment '菜单排序'")
    @ApiModelProperty("菜单排序")
    private int sort;


    @TableField(value = "title")
    @Column(name = "title", columnDefinition = "varchar(64) comment '菜单标题'")
    @ApiModelProperty("菜单标题")
    private String title;

    @TableField(value = "parent")
    @Column(name = "parent", columnDefinition = "varchar(64) comment '父菜单'")
    @ApiModelProperty("父菜单")
    private String parent;

    @TableField(value = "url")
    @Column(name = "url", columnDefinition = "varchar(64) comment '菜单点击路径'")
    @ApiModelProperty("菜单点击路径")
    private String url;

    @TableField(value = "icon")
    @Column(name = "icon", columnDefinition = "varchar(64) comment '菜单图标'")
    @ApiModelProperty("菜单图标")
    private String icon;

    @TableField(value = "menu_type")
    @Column(name = "menu_type", columnDefinition = "int(10) comment '菜单类型(枚举MenuType)'")
    @ApiModelProperty("菜单类型(枚举MenuType)")
    private Integer menuType;

    @TableField(value = "gs_show")
    @DefaultValue("1")
    @Column(name = "gs_show", columnDefinition = "tinyint(1) comment '该菜单是否显示'")
    @ApiModelProperty("该菜单是否显示")
    private boolean show;

}
